package com.huaboot.framework.redis.utils;

/**
 * 生成key工具类
 * description: RedisKeyUtil
 * author: ff
 */
public class RedisKeyUtil {
    /**
     * 标准key开头
     */
    private static final String KEY_PREFIX = "huaboot:";

    public static String generateKey(String prefix, String... parts) {
        StringBuilder sb = new StringBuilder(KEY_PREFIX);
        if (prefix != null && !prefix.isEmpty()) {
            sb.append(prefix).append(":");
        }
        for (String part : parts) {
            sb.append(part).append(":");
        }
        sb.deleteCharAt(sb.length() - 1);
        return sb.toString();
    }
}
